package ai.mspbots.service.query.config;

import co.elastic.apm.attach.ElasticApmAttacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class ApmCommandRunner implements CommandLineRunner {

    @Autowired
    ElasticApmConfiguration elasticApmConfiguration;
    @Override
    public void run(String... args) throws Exception {
        Map<String, String> config = elasticApmConfiguration.getConfig();
        ElasticApmAttacher.attach(config);
    }
}
